package clientmgl;

import interfaces.impl.HumanInteraction;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JMenuItem;
import javax.swing.JPopupMenu;

public class PopUpInteraction extends JPopupMenu{
	
	private HumanInteraction humanInteraction=null;
	private int numParameters =0;
	
	
	
	MainFrame mainFrame;
	
	public PopUpInteraction( String splt[],final MainFrame mainFrame){
		super();
		JMenuItem menu ;
		this.mainFrame=mainFrame;
		
		for(int i =1; i<splt.length;i++){
			menu = new JMenuItem(splt[i]);
			add(menu);
			
			
			menu.addActionListener(new ButtonClicked(splt[i]));
			
			}
		
		
		
	}		
	
	
	public PopUpInteraction() {
		
	}
	
	
	private class ButtonClicked implements ActionListener {
		String str =null;
		ButtonClicked(String s){
			this.str=s;
			
		}

		@Override
		public void actionPerformed(ActionEvent e) {
			// TODO Auto-generated method stub
			System.out.println("active action performed del popUp");
			if(str!=null)
				mainFrame.sendAgentChosed(str);
			
		}
		
	}


	
	
	
}
